boost12 2.2.0
Loading...
Searching...
No Matches
boost12.h
Go to the documentation of this file.
1/****************************************************************************
2** Copyright (C) 2020 MikroElektronika d.o.o.
3** Contact: https://www.mikroe.com/contact
4**
5** Permission is hereby granted, free of charge, to any person obtaining a copy
6** of this software and associated documentation files (the "Software"), to deal
7** in the Software without restriction, including without limitation the rights
8** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9** copies of the Software, and to permit persons to whom the Software is
10** furnished to do so, subject to the following conditions:
11** The above copyright notice and this permission notice shall be
12** included in all copies or substantial portions of the Software.
13**
14** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
19** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20** USE OR OTHER DEALINGS IN THE SOFTWARE.
21****************************************************************************/
22
27
28#ifndef BOOST12_H
29#define BOOST12_H
30
31#ifdef __cplusplus
32extern "C"{
33#endif
34
39#ifdef PREINIT_SUPPORTED
40#include "preinit.h"
41#endif
42
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
45 #include "delays.h"
46 #endif
47#endif
48
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_pwm.h"
52
58
63
68
73#define BOOST12_DEF_PWM_FREQ 5000
74#define BOOST12_DEF_PWM_DC 0.0
75 // boost12_cfg
77
82
87
92#define BOOST12_MAP_MIKROBUS( cfg, mikrobus ) \
93 cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM );
94 // boost12_map // boost12
97
102typedef struct
103{
104 // Modules
105 pwm_t pwm;
106
107 // ctx variable
108 uint32_t pwm_freq;
109
110} boost12_t;
111
116typedef struct
117{
118 // Communication gpio pins
119 pin_name_t pwm;
120
121 // Static variable
122 uint32_t dev_pwm_freq;
123
125
130typedef enum
131{
134
136
142
153
168
182
194err_t boost12_set_duty_cycle ( boost12_t *ctx, float duty_cycle );
195
207
219
220#ifdef __cplusplus
221}
222#endif
223#endif // BOOST12_H
224 // boost12
226
227// ------------------------------------------------------------------------ END
boost12_return_value_t
Boost 12 Click return value data.
Definition boost12.h:131
@ BOOST12_OK
Definition boost12.h:132
@ BOOST12_ERROR
Definition boost12.h:133
err_t boost12_pwm_start(boost12_t *ctx)
Boost 12 start PWM module.
err_t boost12_default_cfg(boost12_t *ctx)
Boost 12 default configuration function.
err_t boost12_pwm_stop(boost12_t *ctx)
Boost 12 stop PWM module.
err_t boost12_set_duty_cycle(boost12_t *ctx, float duty_cycle)
Boost 12 sets PWM duty cycle.
err_t boost12_init(boost12_t *ctx, boost12_cfg_t *cfg)
Boost 12 initialization function.
void boost12_cfg_setup(boost12_cfg_t *cfg)
Boost 12 configuration object setup function.
Boost 12 Click configuration object.
Definition boost12.h:117
uint32_t dev_pwm_freq
Definition boost12.h:122
pin_name_t pwm
Definition boost12.h:119
Boost 12 Click context object.
Definition boost12.h:103
uint32_t pwm_freq
Definition boost12.h:108
pwm_t pwm
Definition boost12.h:105